import { defineStore } from 'pinia';

 

export const useThemeStore = defineStore('theme', {
  state: () => ({
    mainColor: localStorage.getItem('themeColor') || '#1a1a1a',
  }),
  actions: {
    setMainColor(color) {
      this.mainColor = color;
      localStorage.setItem('themeColor', color);
      document.documentElement.style.setProperty('--mainColor', color);
      document.documentElement.style.setProperty('--dark-bg', color); // 更新 --dark-bg
    },
  },
});